#ifndef __LIB_DIRECTORY_H__
#define __LIB_DIRECTORY_H__
#include "libutilsbase.h"


#if defined(WINDOWS) || defined(_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif

LIB_NS_BEGIN

enum FileSystemOpt
{
	nothing = 0x00, incfile = 0x01,incdir = 0x02,incsub = 0x04
};

class LIBAPI UDirectory
{
public:
	static	tstring	GetCurrentDirectory();
	static	bool	SetCurrentDirectory(const TCHAR* dir);


	static	bool		SetAppDirectory();
	static	tstring		GetAppDirectory();
	

	static	tstring	JoinPath(const TCHAR* a,const TCHAR* b);
	static tstring AppendEscape(const tstring& dir);
	static tstring ToUnix(const tstring& pname);
	static tstring ToDos(const tstring& pname);
	static tstring ToNative(const tstring&  pname);
	static tstring AbsPath(const TCHAR* relatepath);
	static bool IsDirectoryExist(const TCHAR* pdirname);	
	static bool CreateDirectory(const TCHAR* Path);
	static bool DeleteDirectory(const tstring dir,	int32 option = incfile | incsub );


	static	void		ExporerDirectory(const TCHAR* dir = _T("."));

	static	tstring GetSystemDirectory();
	static	tstring	GetWindowsDirectory();

	
	

#ifdef WIN32
	static tstring GetShortPathName(const tstring& pname);
	static tstring GetLongPathName(const tstring& pname);
	static tstring GetFullPathName(const tstring& pname);
#endif
	static void SplitPath(const TCHAR *path, TCHAR *drive, TCHAR *dir, 
		TCHAR *fname,TCHAR *ext);
	static void SplitPath(const tstring& path, tstring* drive, tstring *dir,
		tstring *fname, tstring *ext);
	static bool Rename(const tstring& oldname,const tstring& newname);
	static void GetSubAllDirFiles(const TCHAR* parent,tstrings& subs,
		int32 opt = incsub | incfile );

private:
	UDirectory();
};


LIB_NS_END
#endif